package servlets;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import bean.Member;
import bean.MemberAdm;

@SuppressWarnings("serial")
public class confirmMailServlet extends HttpServlet{
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		String ID = req.getParameter("id");
		MemberAdm memAdm = new MemberAdm();
		Member mem = memAdm.confirmMail(ID);
		
		HttpSession session = req.getSession();
		session.setAttribute("userID", mem.getUserID());
		session.setAttribute("id", mem.getKey().getId());
		session.setAttribute("state", mem.isState());
		session.setAttribute("phone", mem.getPhone().getNumber());
		session.setAttribute("mail", mem.getEmail().getEmail());
		session.setAttribute("name", mem.getName());
		session.setAttribute("address", mem.getAddress());
		session.setAttribute("coMem", mem.isCostcoMem());
		
		req.getRequestDispatcher("./index.jsp").forward(req, resp);
	}
}
